package com.itheima.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.dao.PermissionDao;
import com.itheima.pojo.Permission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service(interfaceClass = PermissionService.class)
@Transactional
public class PermissionServiceImpl implements PermissionService{
    @Autowired
    private PermissionDao permissionDao;

    //查询所有权限
    public List<Permission> findAll() {
       List<Permission> data =  permissionDao.findAll();
        return data;
    }

    //根据角色id查询对应的权限id
    public List<Integer> findPermissionIdsByRoleId(Integer roleId) {
       List<Integer> list = permissionDao.findPermissionIdsByRoleId(roleId);
        return list;
    }
}
